package com.qkl.xiatang.app.utils.appenum;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * app用户状态
 * 状态，0申请注册、1正常、2冻结、3注销
 */
@Getter
public enum AppUserStatus {


    APPLY(0,"申请注册,未审核"),
    OK(1,"正常"),
    FREEZE(2,"已冻结"),
    CANCEL(3,"已注销"),
    ;

    private AppUserStatus(Integer status,String name){
        this.status = status;
        this.name = name;
        EnumUtil.MAP_ENUM.put(status,name);
    }

    public static boolean isOK(Integer status){
        return OK.status.equals(status) || APPLY.status.equals(status);
    }

    public static boolean isCancel(Integer status){
        return CANCEL.status.equals(status);
    }

    public static boolean isApply(Integer status){
        return APPLY.status.equals(status);
    }

    public static String getName(Integer status){
       return EnumUtil.MAP_ENUM.get(status);
    }

    private Integer status;

    private String name;

    private static  class EnumUtil{
        public static Map<Integer,String> MAP_ENUM = new HashMap<>();
    }

}
